<form id="editForm" class="panel-body form-horizontal form-padding">
	<input type="hidden"  name="#(businessTravel).id" class="form-control" value="#(bt?bt.id:'')">
	<div class="form-group">
		<label class="col-md-2 control-label">申请人</label>
		<div class="col-md-4">
			<input type="hidden"  name="#(businessTravel).userid" class="form-control"  value="#if(bt)#(bt.userid)#else#(user.id)#end">
			<input type="text"  name="#(businessTravel).applyer_name" class="form-control"  value="#if(bt)#(bt.applyer_name)#else#(user.name)#end" readonly>
		</div>
		<label class="col-md-1 control-label">部门</label>
		<div class="col-md-4">
			<input type="hidden"  name="#(businessTravel).org_id" class="form-control"  value="#if(bt)#(bt.org_id)#else#(org.id)#end">
			<input type="text"  name="#(businessTravel).org_name" class="form-control"  value="#if(bt)#(bt.org_name)#else#(org.name)#end" readonly>
		</div>
	</div>
	<div class="form-group">
		<label class="col-md-2 control-label">职位</label>
		<div class="col-md-2">
			<input type="text" class="form-control"  name="#(businessTravel).applyer_position"  value="#if(bt)#(bt.applyer_position)#else#(user.position)#end" readonly>
		</div>
	</div>
	<div class="form-group">
		<label class="col-md-2 control-label">考勤号</label>
		<div class="col-md-2">
			<input type="text" class="form-control"  name="#(businessTravel).def1"  value="#(bt?bt.def1:'')"  #if(view=='detail') readonly #end>
		</div>
	</div>
	<input type="hidden"  name="#(businessTravel).id" class="form-control" value="#(bt?bt.id:'')">
	<div class="form-group">
		<label class="col-md-2 control-label">目的地</label>
		<div class="col-md-4">
			<input type="text"  name="#(businessTravel).destination" class="form-control"  value="#(bt?bt.destination:'')" #if(view=='detail') readonly #end>
			<small class="help-block">请输入目的地</small>
		</div>
		<label class="col-md-1 control-label">客户名称</label>
		<div class="col-md-4">
			<input type="text"  name="#(businessTravel).customer_name" class="form-control"  value="#(bt?bt.customer_name:'')" #if(view=='detail') readonly #end>
			<small class="help-block">请输入客户名称</small>
		</div>
	</div>
	#@installSelectBusinessButton(businessTravel,0,"借款单据","borrow_id","borrow_code",bt?bt.borrow_id:"",bt?bt.borrow_code:"","oa_apply_borrow_money","id:主键","code:借款单","money:金额,pay_type:付款方式,repay_type:还款方式")
	<div class="form-group">
		<label class="col-md-2 control-label">开始时间</label>
		<div class="input-group date form_datetime col-md-4" style="float:left">
			<input type="text" id="startTime" name="#(businessTravel).start_time" class="form-control"  value="#(o?o.start_time:'')" readonly>
			<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
		</div>
		<label class="col-md-1 control-label">结束时间</label>
		<div class="input-group date form_datetime col-md-3" style="float:left">
			<input type="text" id="endTime" name="#(businessTravel).end_time" class="form-control"  value="#(o?o.end_time:'')" readonly>
			<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
		</div>
	</div>
	<div class="form-group">
		<label class="col-md-2 control-label">出差事由</label>
		<div class="col-md-9">
			<textarea rows="8" name="#(businessTravel).reason" class="form-control" #if(view=='detail') readonly #end>#(bt?bt.reason:'')</textarea>
			<small class="help-block">请输入出差事由</small>
		</div>
	</div>
	<div class="form-group">
		<label class="col-md-2 control-label">项目编码</label>
		<div class="col-md-8">
			<input type="text"  name="#(businessTravel).project_id" class="form-control"  value="#(bt?bt.project_id:'')" #if(view=='detail') readonly #end>
			<small class="help-block">请输入项目编码</small>
		</div>
	</div>
	<div class="form-group">
		<label class="col-md-2 control-label">项目名称</label>
		<div class="col-md-8">
			<input type="text"  name="#(businessTravel).project_name" class="form-control"  value="#(bt?bt.project_name:'')" #if(view=='detail') readonly #end>
			<small class="help-block">请输入项目名称</small>
		</div>
	</div>
	<div class="form-group">
		<label class="col-md-2 control-label">备注</label>
		<div class="col-md-9">
			<textarea rows="8" name="#(businessTravel).des" class="form-control" #if(view=='detail') readonly #end>#(bt?bt.des:'')</textarea>
			<small class="help-block">备注</small>
		</div>
	</div>
	#if(view=='edit')
		<div class="panel-footer">
			<div class="row">
				<div class="col-sm-8 col-sm-offset-3">
					<button class="btn btn-warning" type="reset" #if(view=='detail') disabled #end>重置</button>
					<button class="btn btn-primary" type="submit" #if(view=='detail') disabled #end>保存</button>
				</div>
			</div>
		</div>
	#else

	#end
</form>

<script>
	$(document).ready(function() {
		$('.form_datetime').datepicker({format: 'yyyy-mm-dd',weekStart: 1,todayBtn:  1,autoclose: 1,language:  'zh-CN',todayHighlight: 1,forceParse: 0,showMeridian: 1}).on('changeDate',function(){
			var startTime = $("#startTime").val();
			var endTime = $("#endTime").val();
			if(startTime&&endTime){
				if(!dateUtil.compareCalendar(startTime,endTime)){
					pointLion.alertMsg("开始时间大于结束时间","danger",null,null);
					$("#editForm .btn").attr("disabled","disabled");
				}else{
					resetVali();
				}
			}
		});
	});
	function resetVali(){
		if(!$("#editForm").data('bootstrapValidator').isValid()) {
			$("#editForm").data('bootstrapValidator').resetForm();
			$(".btn").removeAttr("disabled");
		}
	}
</script>